﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace JTicket.UI
{
    public partial class S_EditePwd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
                this.Tb1.Text = bllOper.Oper().OperCode;
            }
        }

        protected void BtnPwd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (BLL.D_OperInfo.OperLogin(this.Tb1.Text.Trim(), this.tb2.Text.Trim()))
                {
                    string YX_AdminUser = this.Tb1.Text.Trim();
                    string YX_Pwd = this.tb3.Text.Trim();
                    try
                    {
                        BLL.D_OperInfo.isRePwd(YX_AdminUser, YX_Pwd);
                        Common.JsMsg.Alert("修改成功！");
                     
                    }
                    catch
                    {
                        Common.JsMsg.Alert("修改失败, 操作已回滚！");
                    }
                }
                else
                    Common.JsMsg.Alert("用户名或密码错误！");
            }
        }
        protected void CustomValidator2_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (this.tb3.Text.Trim() == this.TextBox2.Text.Trim())
            {
                args.IsValid = true;
            }
            else
            {
                args.IsValid = false;
            }
        }
    }
}